package com.base.cn.platform.os.service.course.qa.qareply;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 问题评论Service
 * @author LIZHIPENG
 * @since 2018/4/26
 */
@FeignClient(name = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface QaReplyService extends CourseBaseService {

    /**
     * 查询评论数量
     * @param params 条件
     * @return
     */
    @RequestMapping(contextPath + "/replyCount")
    BigDecimal replyCount(@RequestBody Map<String, Object> params);

    /**
     * 分页查询问题评论列表
     * @param currentPage 页码
     * @param qaReply 查询条件
     * @param createUserData 是否设置用户信息
     * @param childData 是否设置子评论
     * @return
     */
    @RequestMapping(contextPath + "/findQaReplyListPage")
    Map<String, Object> findQaReplyListPage(@RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                            @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
                                            @RequestBody Map<String, Object> qaReply,
                                            @RequestParam("createUserData") boolean createUserData,
                                            @RequestParam("childData") boolean childData);

    /**
     * 问题评论
     * @param qaReply
     * @return
     */
    @RequestMapping(contextPath + "/saveQaReply")
    Map<String, Object> saveQaReply(@RequestBody Map<String, Object> qaReply);

    /**
     * 判断用户是否回答过问答
     * @param userId 用户ID
     * @param qaId 问答 ID
     * @return true回复过，false未回复
     */
    @RequestMapping(contextPath + "/isUserReply")
    boolean isUserReply(@RequestParam("userId") BigDecimal userId, @RequestParam("qaId") BigDecimal qaId);


    /**
     * 查询用户回复的问答量
     * @param userId 用户ID
     * @return 回复的问答数量
     */
    @RequestMapping(contextPath + "/queryUserReplyQaNum")
    int queryUserReplyQaNum(@RequestParam("userId") BigDecimal userId);
}
